local PANEL = {}

function PANEL:Init()

	self.ListMenu = vgui.Create( "DPanelList", self.MainGUI )
	self.ListMenu:EnableVerticalScrollbar( true )
	self.ListMenu:SetSpacing( 1 )
	self.ListMenu:SetPadding( 1 )
	
	hook.Call("UpgradesStart", GAMEMODE )

end

function PANEL:AddCategory( tbl )

	local Category = vgui.Create( "DCollapsibleCategory", self )
	
	self.ListMenu:AddItem( Category )
	Category:SetLabel( tbl.Name )
	Category:SetCookieName( "ArcUpgrdesa."..tostring(Name) )
	
	local CategoryContent = vgui.Create( "DPanelList" )
		CategoryContent:SetAutoSize( true )
		CategoryContent:SetDrawBackground( false )
		CategoryContent:SetSpacing( 0 )
		CategoryContent:SetPadding( 0 )
	
	Category:SetContents( CategoryContent )

	for k, v in pairs( tbl.Items ) do
		
		local Item = vgui.Create( "UpgradesItem" )
		
		Item:SetText( v.Name )
		Item:SetTable( v )
		
		CategoryContent:AddItem( item )
		
	end
	
end





function PANEL:PerformLayout()
	
	local parent = self:GetParent()

	self:SetPos( 4, 24 )
	self:SetSize( parent:GetWide() - 8, parent:GetTall() - 26 )

	self.ListMenu:SetPos( 0, 0 )
	self.ListMenu:SetSize( 140, self:GetTall() )

end

vgui.Register( "UpgradesMenu", PANEL, "Panel" )